<?php

$smarty->configLoad($lang . '/survey.module.php');
$language = parse_ini_file($lang . '/breadcrumb.module.php', true);
$breadcrumb = $language['survey'];


if(empty($_GET['charID'])) {
	$_GET['charID'] = '';
}
$sql = 'SELECT id, name FROM ' . DB_GAME . '.players WHERE id = :id';
$dbh = $connection->prepare($sql);
$dbh->bindValue(':id', $_GET['charID']);
$dbh->execute();
$row = $dbh->fetch(PDO::FETCH_ASSOC);
$smarty->assign('name', $row['name']);
$user = new user;
$char = new character;
if(isset($_POST['submit'])) {
	
	$charID = $char->getCharId($_POST['charname']);
	$main->logAction($_SESSION['id'], 'survey');
	$setlang	= parse_ini_file($lang . '/survey.module.php', true);
	$message	= $setlang['message'];
	$title		= $setlang['title'];
	$sendername = $setlang['sendername'];
	$itemid = $_POST['itemid'];
	//$user->sendIngameMail($title, $charID, $message, $sendername, $itemid);
	$main->jqmodal('addet');
	echo '<meta http-equiv="refresh" content="3; URL=index.php?mod=survey">';
}

$template = 'survey/index.tpl';
?>
 